<?php
class ConfModel
{
	static private $_conf = array();
	static private $i = 0;
	static private $_tableName = 'sys_config'; 
	
	static public function getTableName()
	{
		return self::$_tableName;
	}
	
	static public function get($key)
	{
		$rows = self::getAll();
		return isset($rows[$key]) ? $rows[$key] : '';
	}
	
	static public function set($key,$value)
	{
		
	}
	
	static public function getAll()
	{
		if (empty(self::$_conf))
		{
			$result = array();
			$sql = 'select * from '.self::getTableName();
			$rows = DB::fetchAll($sql);
			if (is_array($rows) && !empty($rows))
			{
				foreach($rows as $k => $v)
				{
					$kVal = $v['config_key'];
					$vVal = $v['config_val'];
					$result[$kVal] = $vVal;
				}
			}
			self::$_conf = $result;
		}
		return self::$_conf;
	}
	
	
	
}